-- card: 11595 from stack: in.0 -- bmap block id: 6374 -- flags: 4000 -- background id: 11496 -- name: Searchreplace in Hypertalk -- part contents for background part 1 ----- text ----- Sometimes you may want to perform the functions of the searchreplace XCMD from a script without loading the XCMD’s window. In this case, there is no reason to use the XCMD at all, since its purpose is to provide an interactive window. In its place, you can use hypertalk scripts that are essentially what the XCMD sends back to hypercard to perform the search and replace functions. There are two handlers. The first handler is called from a script with the form search Find What String, find method where search is the handler keyword, Find What String is the string to be searched for, and find method is the method to do the search, either string or whole. A space is required after search as well as a comma after the first argument. You need double neutral quotation marks (") around the first argument if it is more than one word. If the find is successful, it puts the start and end character positions of the string it found into a global variable. You can replace this string by calling a second handler from a script with the form replace ReplaceWithString